package com.keliangliu.demo.bean;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.OpenOption;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.IntConsumer;

public class BeanDemo {


    public static void main(String[] args) throws IOException {
        Function<String,Integer> function = new Function<String, Integer>() {
            @Override
            public Integer apply(String s) {
                System.out.println(s.length());
                return s.length();
            }
        };
//        getNum("app",function);
//
//        List<String> list = Arrays.asList("a","b","c");
//
//        Files.writeString(Paths.get("/Users/lkl/IdeaProjects/springboot-lock-bean-demo/src/main/resources/application.properties"),"\n3333",StandardCharsets.UTF_8, StandardOpenOption.APPEND);
//
//        String s  = Files.readString(Paths.get("/Users/lkl/IdeaProjects/springboot-lock-bean-demo/src/main/resources/application.properties"),
//                StandardCharsets.UTF_8);
//        System.out.println(s);

    }



    public static <T,R> R getNum(T app,Function<T,R> function) {
        System.out.println(app.getClass().getTypeName());
        return function.apply(app);
    }
}
